package com.design.pattern.createmode.singleton;

/**
 * 创建型模式-单例模式-饿汉模式2
 * @author yll
 * @version 1.0.0
 * @date 2024/03/14 14：42
 * @desc 单例实例在类装载的时候（使用静态代码块）进行创建，是线程安全的
 * */
public class SingletonExample_02_02 {

    private SingletonExample_02_02(){}

    private static SingletonExample_02_02 singleton = null;

    static {
        singleton = new SingletonExample_02_02();
    }

    public static SingletonExample_02_02 getInstance(){
        return singleton;
    }
}
